package com.coldworks.base.util;

import java.util.List;

import com.coldworks.coldjoke.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class BaseGuideAdapter extends BaseAdapter {
	private Context ctx;
	private List<Integer> imgs;

	public BaseGuideAdapter(Context ctx, List<Integer> imgs) {
		this.ctx = ctx;
		this.imgs = imgs;
	}

	@Override
	public int getCount() {
		if (imgs == null) {
			return 0;
		}
		return imgs.size();
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView,
			final ViewGroup parent) {

		View view = View.inflate(ctx, R.layout.base_guide, null);
		ImageView guideView = (ImageView) view
				.findViewById(R.id.guideImageView);
		guideView.setImageResource(this.imgs.get(position));
		return view;
	}

}
